package com.probox.common.entity.service.wechat;

import com.alibaba.fastjson.JSONObject;
import com.probox.wechat.api.domain.WechatAuthorizationInfoVo;
import com.probox.common.entity.domain.wechat.AppletInfo.AppealRecord;
import com.probox.wechat.api.domain.WxQrCode;
import com.probox.common.entity.domain.wechat.EnterpriseInfo;
import com.probox.common.entity.domain.wechat.WechatAppletInfo;
import com.probox.common.entity.domain.wechat.WechatAuthorizationInfo;
import com.probox.common.entity.domain.wechat.vo.CanSetCategoryInfoVo;
import com.probox.common.entity.domain.wechat.vo.CodeTemplateVo;

import java.io.File;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;

/**
 * 小程序接口服务
 */
public interface WechatMiniService {
    //request 合法域名
    public static final String requestdomain = "https://console.yooruan.com";
    //socket 合法域名
    public static final String wsrequestdomain = "wss://console.yooruan.com";
    //uploadFile 合法域名
    public static final String uploaddomain = "https://upload-z2.qiniup.com";
    //downloadFile 合法域名
    public static final String downloaddomain = "https://images.tongkeer.com";

    //downloadFile 合法域名2
    public static final String downloaddomainTwo = "https://t00img.yangkeduo.com";

    public static final String downloaddomainThree = "https://resource.tkmall.tongkeer.com";

    public static final String downloaddomainFour = "https://thirdwx.qlogo.cn";
    //小程序业务域名
    public static final String webviewdomain = "https://wx.yooruan.com";

    /**
     * 1-7个大模块，每个模块建立对应的controller和service
     */

    //1 代商家注册小程序
    //1.1 快速注册企业小程序
    public String registerApplet(EnterpriseInfo enterpriseInfo);
    //1.1.2 查询创建任务状态
    public String findCreateTask(EnterpriseInfo enterpriseInfo);
    //1.2 复用公众号主体快速注册小程序
    public String ToAuthorization(String indexUrl,String authorizationInfo)throws IOException;
    //1.2.2 跳转至第三方平台，第三方平台调用快速注册 API 完成注册
    public String speedinessRegiter(String ticket,String authorizationToken,String platformid,String allworkAppid,String bindRefreshToken);
    //1.3 跳转换绑管理员页面
    public String IntieAdmin(String indexUrl,String authorizationType)throws IOException;
    //1.3.1 换绑小程序管理员接口
    public String IntieRegiter(String taskid,String bindAllworkAppid,String bindRefreshToken,String appid);

    //2  小程序基础信息设置接口 & 授权相关接口
    //21 获取授权方的帐号基本信息
    public HashMap getAuthorizerInfo(String authorizationType,String platformid);
    //22 获取基本信息
    public WechatAppletInfo getAppletInfo(String authorizationType);
    //23 设置服务器域名
    public String modifyDomain(String action,String platformid,String authorizationType);
    //24 设置业务域名
    public String setwebviewdomain(String action,String platformid,String authorizationType);
    //3  小程序成员管理接口
    //31 绑定微信用户为体验者
    public String bindTester(String wechatid,String authorizationType);
    //3.1.2 获取体验者列表
    public String getmemberauthList(String authorizationType);
    //32 解除绑定体验者
    public String unbindTester(String wechatid,String authorizationType);
    // 3.3 设置名称
    public String setAppletName(String nickName,String media_id,String authorizationType);
    // 3.4 修改头像
    public String modifyheadimage(String headImgMediaId, String x1, String y1, String x2, String y2,String authorizationType);
    // 3.5 修改简介
    public String modifysignature(String signature,String authorizationType);


    //4   小程序代码管理接口
    //400 获取代码模板列表
    public CodeTemplateVo gettemplatelist(String templateType,String authorizationType);

    /**
     * 修改版本号
     * @param templateVo
     */
    public void updateTemplateVersion(CodeTemplateVo templateVo,String authorizationType );

    //401 上传代码
    public String uploadCode(String templateId,String templateType,String userVersion,String userDesc,String authorizationType,Boolean funcType);
    //402 获取体验版二维码
    public String getQrcode(String authorizationType) throws IOException;
    //403 提交审核
    public String submitAudit(String userVersion,Boolean releaseType,String authorizationType,Boolean funcType);
    //404 查询最新一次提交的审核状态
    public HashMap getLatestAuditstatus(String authorizationType);
    //405 小程序审核撤回
    public String undocodeaudit(String authorizationType);
    //406 发布已通过审核的小程序  status  0:自动发布  1：手动发布
    public String release(String appid,String authorizationType);;
    //407 版本回退
    public String revertcoderelease(String appVersion,String authorizationType);
    //408 设置最低基础库版本
    public String setweappsupportversion(String version,String authorizationType);
    //409 查询服务商的当月提审限额（quota）和加急次数
    public String queryquota(String authorizationType);
    //410 加急审核申请
    public String speedupaudit(String auditid,String authorizationType);

    //5 小程序类目管理接口
    //51 获取已设置的所有类目
    public List getcategory(String authorizationType);
    //51 添加类目
    public String addcategory(String first,String second,String key,String value,String authorizationType);
    //53 删除类目
    public String deletecategory(String first, String second,String authorizationType);


    //6  违规和申诉管理
    //61 获取小程序违规处罚记录
    public String getillegalrecords(String authorizationType);
    //62 获取小程序申诉记录
    public  List<AppealRecord> getappealrecords(String illegalRecordId,String authorizationType);


    //7  其他小程序业务接口
    //71 获取 URL Link
    public String generateUrllink(String authorizationType);
    //72 获取小程序scheme码
    public String generatescheme(String authorizationType);

    //8 素材管理
    //8.1 新增临时素材


    public JSONObject uploadMedia(String type, String platformid,String authorizationType, File file) throws Exception;
    // 8.2 获取临时素材
    public String getTemporaryMaterial(String mediaId,String authorizationType);

    //设置支付方式
    public String setPaymentType(String merchantID,String authorizationType);

    //获取授权信息
    public WechatAuthorizationInfo getAuthorizerAppid(String authorizationType);

    //处理审核推送结果
    public Boolean updateAuditInfo(Boolean issueStatus,String appid,String authorizationType);

    //获取可设置的所有类目
    public List<CanSetCategoryInfoVo> getallcategories(String authorizationType);

    //判断是否绑定第三方
    public HashMap isBind(String authorizationType);

    //获取小程序码
    public String getwxacodeunlimit(WxQrCode wxQrCode);

    /**
     * 刷新Token
     * @param authorizationType
     * @return
     */
    public WechatAuthorizationInfo refreshToken(String authorizationType);

    /**
     * 刷新令牌(指定平台)
     */
    public WechatAuthorizationInfo PlatformRefreshToken(String authorizationType,String platformid);

    /**
     * 新增h5授权信息
     * @param wechatAuthorizationInfoVo
     * @return
     */
    public Boolean saveAuthorizationInfo(WechatAuthorizationInfoVo wechatAuthorizationInfoVo);

    //查询当前平台指定类型信息
    public WechatAuthorizationInfoVo getAuthorizationInfoByPlatform(WechatAuthorizationInfoVo wechatAuthorizationInfoVo);


}
